package zheezes.protocol.impl.gbw.afn0d;

import zheezes.protocol.impl.gbw.DataUnit;
import zheezes.protocol.impl.gbw.format.DataForm15;

public abstract class AbstractAfn0DCurveDataDataUnit extends DataUnit {
	private DataForm15 stime = new DataForm15();
	private byte density;
	private byte amount;

	@Override
	public int sizeOfData() {
		return DataForm15.SIZE + 1 + 1;
	}

	@Override
	public int getData(byte[] buf, int offset) {
		int idx = offset;
		idx += stime.getBytes(buf, idx);
		buf[idx++] = density;
		buf[idx++] = amount;

		return idx - offset;
	}

	@Override
	public int setData(byte[] buf, int offset, int max) {
		int idx = offset;
		idx += stime.setBytes(buf, idx);
		density = buf[idx++];
		amount = buf[idx++];

		return idx - offset;
	}

	public DataForm15 getStime() {
		return stime;
	}

	public void setStime(DataForm15 stime) {
		this.stime = stime;
	}

	public byte getDensity() {
		return density;
	}

	public void setDensity(byte density) {
		this.density = density;
	}

	public byte getAmount() {
		return amount;
	}

	public void setAmount(byte amount) {
		this.amount = amount;
	}
}